home *** CD-ROM | disk | FTP | other *** search
/ Imagine the Universe (9th Edition) / Imagine the Universe 9 - Disc 1.iso / mac / imagine / YBA / M31-velocity / javascript / doppler-quiz3.js < prev    next >
Text File  |  2003-01-12  |  746b  |  36 lines

  1. size1 = "Blank";
  2. size2 = "Blank";
  3. size3 = "Blank";
  4.  
  5. function testButton(form) {
  6.     for (Count = 0; Count < 5; Count++) {
  7.         if (form.answer1[Count].checked)
  8.     size1 = Count;
  9.     if (form.answer2[Count].checked)
  10.     size2 = Count;
  11.     if (form.answer3[Count].checked)
  12.     size3 = Count;
  13.     }
  14.     
  15.     RightAnswer1 = 2;
  16.     RightAnswer2 = 4;
  17.     RightAnswer3 = 1;
  18.     NumberCorrect = 0;
  19.     AnswerPage = './doppler-quiz-3-answer.html';
  20.     
  21.     if (size1 == RightAnswer1) {
  22.         NumberCorrect++;
  23.     }
  24.     if (size2 == RightAnswer2) {
  25.         NumberCorrect++;
  26.     }
  27.     if (size3 == RightAnswer3) {
  28.         NumberCorrect++;
  29.     }
  30.     
  31.     alert ("You answered " + NumberCorrect + " out of 3 questions correctly!");
  32.     location = AnswerPage; 
  33. }
  34.  
  35.     
  36.